#!/usr/local/bin/python

# example usage - ./test.py *.wav or python test.py *.wav

from pycdp import *

if __name__ == "__main__":  # python convention, but i think you can leave it out...
    mono  = cdp.housekeep.chans(4)
    norm  = cdp.modify.loudness(3)
    drunk = cdp.extend.drunk(1)


    drunk.outdur = 60
    drunk.locus = 4
    drunk.ambitus = 8
    drunk.step = 1
    drunk.clock = 0.1
    drunk.s = 15
    drunk.o = 0.01
    #drunk.c = 0.5
    
    #dp = cdp.distort.pitch()
    #dp.octvary = 8
    #dp.c = 256 

    scrub = cdp.modify.radical(3)
    scrub.l = -12
    scrub.h = 36
    scrub.dur = 30

    dv = cdp.envel.dovetail(2)
    dv.infadedur = 1024
    dv.outfadedur = 1024
    dv.t = 1 # set time unit to samples

    rev2 = cdp.modify.revecho(3)
    rev2.s = 0.5
    rev2.r = 0.2
    rev2.e = 100

    chain = []
    chain.append(drunk)
    chain.append(scrub)
    chain.append(rev2)
    chain.append(drunk)
    #chain.append(mono)
    chain.append(norm)
    chain.append(dv)

    output_files = cdp.run_chain(chain, sys.argv[1:], False)

    print(output_files) # debug!
